package com.white.androidstudy.green;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.white.androidstudy.bean.Page;
import com.white.androidstudy.bean.User;

import com.white.androidstudy.green.PageDao;
import com.white.androidstudy.green.UserDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig pageDaoConfig;
    private final DaoConfig userDaoConfig;

    private final PageDao pageDao;
    private final UserDao userDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        pageDaoConfig = daoConfigMap.get(PageDao.class).clone();
        pageDaoConfig.initIdentityScope(type);

        userDaoConfig = daoConfigMap.get(UserDao.class).clone();
        userDaoConfig.initIdentityScope(type);

        pageDao = new PageDao(pageDaoConfig, this);
        userDao = new UserDao(userDaoConfig, this);

        registerDao(Page.class, pageDao);
        registerDao(User.class, userDao);
    }
    
    public void clear() {
        pageDaoConfig.clearIdentityScope();
        userDaoConfig.clearIdentityScope();
    }

    public PageDao getPageDao() {
        return pageDao;
    }

    public UserDao getUserDao() {
        return userDao;
    }

}
